class Rectangle {
  constructor(options) {
    'x|y|width|height|color|lineWidth|strokeColor'.split('|').forEach(e=>{
      this[e] = options[e];
    });
    this.draw();
  }

  draw() {
    this.x = this.x | 0;
    this.y = this.y | 0;
    this.width = this.width | 0;
    this.height = this.height | 0;
    this.color = this.color || '#000';
    if (!stage.ctx) return;
    stage.ctx.fillStyle = this.color;
    stage.ctx.fillRect(this.x, this.y, this.width, this.height);

    stage.ctx.lineWidth = this.lineWidth;
    stage.ctx.strokeStyle = this.strokeColor;
    stage.ctx.strokeRect(this.x, this.y, this.width, this.height);
  }
}

class Square {
  constructor(options) {
    'x|y|width|color'.split('|').forEach(e=>{
      this[e] = options[e];
    });
    this.draw();
  }

  draw() {
    this.x = this.x | 0;
    this.y = this.y | 0;
    this.width = this.width | 0;
    this.color = this.color || '#000';
    if (!stage.ctx) return;
    stage.ctx.fillStyle = this.color;
    stage.ctx.fillRect(this.x, this.y, this.width, this.width);
  }
}